#!/bin/bash

VMs=( $(xe vm-list --minimal | sed 's/,/ /g') )

for uuid in ${VMs[@]}; do
	[[ $(xe vm-param-get uuid=${uuid} param-name=name-label) == WXP* ]] && 
	if [[ $(xe vm-param-get uuid=${uuid} param-name=power-state) == halted ]]; then
		xe vm-start uuid=${uuid}
	else
		xe vm-reboot uuid=${uuid}
	fi
done
